<?php require_once("header.php");?>  

<?php $activity = json_decode(api("latest_activity/".$user_id."/0","GET",null),true);?> 
<?php require_once("php/activity.php");?>

<?php if($no_activity):
?>
<div id="tasks"> 
<input id="search_friends" type="button" onClick="window.location='find-friends.php'" value="Find Friends" />
<input id="add_recipe" type="button" onClick="window.location='add-recipe.php'" value="Add a New Recipe" />
</div>
<?php $recipes = json_decode(api("all_recipes/".$user_id,"GET",null),true);?>
<?php if(count($recipes)>0):?>
<?php require_once("php/carousel.php");?>
<?php displayCarousel($recipes,"others","Public Recipes",$user_id);?>

<script>
setFilter();

// tags
<?php $tags = api("tags/","GET",null);?>
var tempTags = <?php echo $tags;?>;
var tags = new Array();
for(var i=0; i<tempTags.length; i++){
	tags[i] = tempTags[i]['name'];;
}

// ingredients
<?php $ingredients = api("ingredients/","GET",null);?>
var tempIngredients = <?php echo $ingredients;?>;
var ingredients = new Array();
for(var i=0; i<tempIngredients.length; i++){
	ingredients[i] = tempIngredients[i]['name'];;
}

var combined = tags.concat(ingredients);
setAutoComplete("tags",false,combined,true);
submitOnEnter(".filter",filter);
</script>

<?php
endif;
endif;?>

<?php require_once("footer.php");?>